package com.zcxy360.sandtable.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zcxy360.sandtable.domain.TeamDrawingHistory;
import com.zcxy360.sandtable.domain.TeamDrawingHistoryMapper;

@Transactional
@Service
public class TeamDrawingHistoryService {

	@Autowired
	private TeamDrawingHistoryMapper teamDrawingHistoryMapper;
	
	public Object getLastHistory(Integer teamId, Integer drawingTypeId) {
		return teamDrawingHistoryMapper.selectLastHistory(teamId,drawingTypeId);
	}
	
	public Object list(Integer teamId, Integer drawingTypeId, Integer pageNum, Integer pageSize, Integer navigatePages) {
		PageHelper.startPage(pageNum, pageSize);
		List<TeamDrawingHistory> teamDrawingHistorys = teamDrawingHistoryMapper.listLastHistory(teamId,drawingTypeId);
		return new PageInfo<>(teamDrawingHistorys, navigatePages);
	}
	
	public boolean post(TeamDrawingHistory teamDrawingHistory) {
		teamDrawingHistoryMapper.insertSelective(teamDrawingHistory);
		return true;
	}


}
